package com.ibm.cps.message;

import java.math.BigInteger;

import org.bson.types.ObjectId;
import org.junit.Test;

import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.ibm.util.JSONUtility;
import com.ibm.util.exception.CPSException;

public class TimeSeries {
	public static void main(String[] args) throws CPSException {
		TimeSeries test = new TimeSeries();
		test.constructSchema(5, "payload");
	}

	
	public void constructSchema(int size, String schemaFieldName) {
		ArrayNode arrayNode = JSONUtility.newArrayNode();
		for (int i = 0; i < size; i++) {
			ObjectNode node = JSONUtility.newObjectNode();
			node.put("name", schemaFieldName + "(" + i + ")");
			node.put("datatype", "double");
			arrayNode.add(node);
		}
		System.out.println(arrayNode.toString());
		String schemaid = new BigInteger(new ObjectId().toByteArray())
				.toString(16);
	}
}
